//
//  UIImage+Extensions.h
//  yuikemall
//
//  Created by yuike6 yuike6 on 12-2-14.
//  Copyright (c) 2012年 yuike. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef enum{
    kPNGImage = 1,
    kJPGEImage,
    kGIFImage,
    kTiffImage,
    kNUKNOWImage
} IMAGETYPE;


@interface UIImage (Extensions)


/*
  获取图片中一个区域的内容，返回一个图片
 */
- (UIImage *)imageAtRect:(CGRect)rect;

/*
 
 */
- (UIImage *)imageByScalingProportionallyToMinimumSize:(CGSize)targetSize;
- (UIImage *)imageByScalingProportionallyToMinimumSize1:(CGSize)targetSize;
- (UIImage *)imageByScalingProportionallyToMinimumSizeWithFocus:(CGSize)targetSize focus:(CGPoint) focus;

/*
 图片成比的缩放到一个大小
 */
- (UIImage *)imageByScalingProportionallyToSize:(CGSize)targetSize;


- (UIImage *)imageByScalingToSize:(CGSize)targetSize;

+(UIImage*) scaleAndRotateImage:(UIImage*)photoimage:(CGFloat)bounds_width:(CGFloat)bounds_height;

/*
  按照一个 弧度 旋转
 */
- (UIImage *)imageRotatedByRadians:(CGFloat)radians;

/*
 按照一个 角度 旋转
 */
- (UIImage *)imageRotatedByDegrees:(CGFloat)degrees;


+ (IMAGETYPE) imageTypeByData:(NSData *) data;

+ (IMAGETYPE) imageTypeByName:(NSString *) fileName;
+ (IMAGETYPE) imageTypeByUrl:(NSURL *) fileUrl;


@end

@interface UIImage (Grayscale)

- (UIImage *)convertToGrayscale ;

@end



@interface UIImage (ColorAtPixel)

- (UIColor *)colorAtPixel:(CGPoint)point;

@end






